package com.example.home.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.home.view.HomeListFragment

class HomePageAdapter constructor(private val fragment: MutableList<HomeListFragment>,fm:FragmentManager,lifecycle: Lifecycle):FragmentStateAdapter(fm,lifecycle) {
    override fun getItemCount(): Int = fragment.size

    override fun createFragment(position: Int): Fragment = fragment[position]

    override fun getItemId(position: Int): Long = position.toLong() //给每个Fragment定义唯一的ID

}